/*
 * Copyright (c) 2023-7-17
 * 说明: 卷的基本结构
 * 考场这边目前没有用到这个功能,直接花钱购买
 */

package coupon

import (
	"go.mongodb.org/mongo-driver/bson/primitive"
	"mongoDB"
	"time"
)

// 单张优惠卷，每种卷都需要按照实际创建对应的数量
type Coupon struct {
	mongoDB.MongoDefaultModelNonID `bson:"basic"`
	ID                             primitive.ObjectID   `bson:"_id,omitempty" json:"id"`
	Name                           string               `bson:"name" json:"name"`
	Characteristic                 CouponCharacteristic `bson:"characteristic" json:"characteristic"` //严格的卷的分类，用来匹配使用
	Rules                          []Rule               `bson:"rules" json:"rules"`                   // 使用限制规则
	Value                          int                  `bson:"value" json:"value"`                   // 抵扣价格，单位分，如果有
	NotBefore                      time.Time            `bson:"not_before" json:"notBefore"`
	NotAfter                       time.Time            `bson:"not_after" json:"notAfter"`
}

func NewCoupon(couponName *string, characteristic *CouponCharacteristic) {
	n := Coupon{
		Name:           *couponName,
		Characteristic: *characteristic,
	}
	n.Create()
}

type Rule struct {
	Name    string
	Content string
}

type CouponCharacteristic string

const (
	DriverSub2WarmUp   CouponCharacteristic = "驾考科目二首次抵扣卷"
	DriverSub2ReWarmUp CouponCharacteristic = "驾考科目二加练抵扣卷"
)
